package day18.feifei.homework;

public class First {
    public static void main(String[] args) {
MyFirst mf1=new MyFirst(100,10);
MyFirst mf2=new MyFirst(200,20);
MyFirst mf3=new MyFirst(300,30);
MyFirst mf4=new MyFirst(400,40);
MyFirst mf5=new MyFirst(500,50);
Thread thread1=new Thread(mf1);
Thread thread2=new Thread(mf2);
Thread thread3=new Thread(mf3);
Thread thread4=new Thread(mf4);
Thread thread5=new Thread(mf5);
thread1.start();
thread2.start();
thread3.start();
thread4.start();
thread5.start();
    }
}
class MyFirst implements Runnable{
private final int num;
private final int n;

   public MyFirst(int num, int n) {
        this.num = num;
        this.n = n;
    }

    @Override
    public void run() {
        int sum=0;
        for(int i=1;i<=n;i++){
            sum=sum+n;
        }
        System.out.println(num+"的前"+n+"项和为"+sum);
    }
}
